using Headspring.Training.Domain.Services;

namespace Headspring.Training.Domain.Model.StateCommands
{
    public class DraftToCancelledCommand : StateCommandBase
    {
        public DraftToCancelledCommand(WorkOrder workOrder, Employee currentUser) : base(workOrder, currentUser)
        {
        }
        public override WorkOrderStatus GetBeginStatus()
        {
            return WorkOrderStatus.Draft;
        }

        protected override WorkOrderStatus GetEndStatus()
        {
            return WorkOrderStatus.Cancelled;
        }

        protected override bool userCanExecute(Employee currentUser)
        {
            return currentUser == _workOrder.Creator;
        }

        public override string TransitionVerbPresentTense
        {
            get { return "Delete"; }
        }

        public override string TransitionVerbPastTense
        {
            get { return "Deleted"; }
        }

        protected override void postExecute(IWorkflowCoordinator coordinator)
        {
            coordinator.EditWorkOrder(_workOrder);
        }
    }
}